import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { viteMockServe } from 'vite-plugin-mock'

export default defineConfig({
  plugins: [
      vue(),
    viteMockServe({
      mockPath: 'mock', // mock文件存放目录
      localEnabled: true, // 开发环境启用
      prodEnabled: false, // 生产环境禁用
      injectCode: `
        import { setupProdMockServer } from './mockProd';
        setupProdMockServer();
      `,
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  }
})